﻿using System.Windows.Controls;
using Geotools.Geometries;

namespace AzukiMap.Map
{
    public class MapCanvas : Canvas, IMapStatus
    {
        MapCoordinate _mapCoordinate;

        // TODO: should be internal
        public MapCanvas(MapCoordinate mapCoordinate)
            : base()
        {
            _mapCoordinate = mapCoordinate;
        }

        #region IMapStatus Members

        public Geotools.Geometries.GTPolygon CurrentExtent
        {
            get { return _mapCoordinate.CurrentExtent;  }
        }

        public Geotools.Geometries.GTPolygon LastExtent
        {
            get { return _mapCoordinate.LastExtent; }
        }

        public Geotools.Geometries.GTPolygon RenderedExtent
        {
            get { return _mapCoordinate.RenderedExtent; }
        }

        public int Srid
        {
            get { return _mapCoordinate.Srid; }
        }

        public CoordinationUnits Unit
        {
            get { return _mapCoordinate.MapUnit; }
        }

        public double Tolerance
        {
            get { return _mapCoordinate.Tolerance;  }
        }

        public bool FlipY
        {
            get { return _mapCoordinate.FlipY; }
        }

        public double ScreenScale
        {
            get { return _mapCoordinate.ScreenScale; }
        }

        public double GeoScale
        {
            get { return _mapCoordinate.GeoScale;  }
        }

        public GTPoint GeoCenter
        {
            get { return _mapCoordinate.GeoCenter; }
        }

        public double Angle
        {
            get { return _mapCoordinate.Angle; }
        }

        public Geotools.Geometries.GTPoint GetPixPointFromGeo(double lon, double lat)
        {
            return _mapCoordinate.GetPixPointFromGeo(lon, lat);
        }

        public Geotools.Geometries.GTPoint GetGeoPointFromPix(double x, double y)
        {
            return _mapCoordinate.GetGeoPointFromPixel(x, y);
        }

        public double ScreenWidth
        {
            get { return _mapCoordinate.ScreenWidth; }
        }

        public double ScreenHeight
        {
            get { return _mapCoordinate.ScreenHeight; }
        }

        public double AdjX
        {
            get { return _mapCoordinate.AdjX; }
        }

        public double AdjY
        {
            get { return _mapCoordinate.AdjY; }
        }

        #endregion
    }
}
